All Questions
47 questions
5votes
1answer
348views
MongoDB cache decorator
I think I cooked again, but maybe not. I'll share with you the product of today's cooking: ...
4votes
2answers
239views
Connecting MongoDB using Motor in FastAPI
What are the best practices for connecting to a database in FastAPI? To provide some context, I want to write code to connect to a MongoDB database using Motor. My idea is to create a single ...
1vote
0answers
109views
Whatsapp Bot using Mongodb
I have this Whatsapp bot made using Twilio and persistent with mongodb due to the nature of the logic I am following the code is become more of a cluttered and seems un-pythonic. It works fine as I ...
1vote
1answer
118views
Archiving MongoDB data to S3, with retryable steps
I have a python script to archive some data (export from mongo to a local json file and then upload it to s3) Is there a better way to implement/improve the current flow? Each step should be be ...
1vote
0answers
142views
Python/Mongo - Generating dummy data
I wrote below piece of code generating dummy data loaded to MongoDB. 2 issues : 1.customer class has subscriber class so it nested with one level customer--> subsciber. I think i'm not doing right: ...
2votes
0answers
743views
mongodb RESTfull api in python using fastapi and mongoengine
So I wrote a a RESTfull api for a mongodb with python3.7, fastapi and mongoengine and id love to get feedback on how I should make my code more readable, clean, and dry. basically there are 4 main ...
2votes
0answers
261views
Simple Flask REST API to a MongoDB
I'm writing a simple REST API to my MongoDB using PyMongo (Python 3.7). Each collection I have in the DB has a route (e.g http://the.api.url/collection_name ), and every document under that collection ...
3votes
1answer
206views
Python REST API and Mongo - Aggregation Pipeline/Stage classes
This has been my approach for "simplifying" MongoDB aggregation queries in a pythonic syntax - was my intent, at the very least: ...
4votes
2answers
238views
MongoDB connection manager
I wrote a class for some MongoDB operations. So far I'm self-taught and mostly I follow the style from already existing code at my workplace (a startup). We don't have a code-review culture, so I'm ...
2votes
0answers
77views
Return aggregated values
It's the first time a write a non-trivial mongodb query, and I came up with one that does work, but is 123 lines long! Surely there must be a way to write it in a more concise way. The purpose of the ...
3votes
2answers
89views
Simple automation executing platform in Python
I'm building a platform like Rundeck/AWX but for server reliability testing. People could log into a web interface upload scripts, run them on servers and get statistics on them ( failure / success). ...
2votes
1answer
1kviews
Import huge XML data set into MongoDB while parsing data
I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow. What am I trying to achieve?...
3votes
1answer
89views
Speed up Python Script to populate MongoDB
How would I go about making this script much faster? Essentially it reads from a file and the slowest part is populating the words. In the words file there are over 100k words and I was looking for a ...
2votes
0answers
37views
Representing LXC component configuration in django
I want to represent components of LXC in django; so I defined them in models: Container, Network, Profile and Devices where each one of them have a set of attributs, but when it comes to representing ...
3votes
0answers
771views
MongoQ - A Task queue system using Mongo
I've been using Beanstaldk (not Amazon's one) for years and loved the possibility to handle delays and priorities in the tasks, but I recently had to filters the tasks for specific reasons, and ...